<template>
  <div class="main">
    <main v-for="(item, index) in renderTuan" :key="index">
      <div class="left">
        <img :src="item.picture" alt="" />
      </div>
      <div class="content">
        <h1>{{ item.name }}</h1>
        <footer>
          <div class="price">
            <div>爆爆团价</div>
            <p>￥{{ item.min_price }}</p>
            <span>￥{{ (item.min_price * 5).toFixed(2) }}</span>
          </div>
          <div class="btn">
            <button>马上抢</button>
            <span>已售{{ item.month_saled }}份</span>
          </div>
        </footer>
      </div>
    </main>
  </div>
</template>

<script setup>
import { waimai_tuan } from "../../api/index";
import { reactive, ref ,onBeforeMount} from "vue";


let renderTuan=ref(null)

 onBeforeMount (() => {
  waimai_tuan({ status: 1 }).then((res) => {
    renderTuan.value = res.data.list;
  });
 
});

</script>

<style lang="css" scoped>
.main {
  height: 475px;
  overflow: auto;
}
.main main {
  height: 100px;
  border-radius: 10px;
  background-color: white;
  margin: 10px;
  display: flex;
  justify-content: space-between;
  border: 1px solid gray;
  padding: 10px;
  align-items: center;
}
.main main .left {
  width: 35%;
  margin-left: 10px;
}
.main main .left img {
  width: 100%;
}
.main main .content {
  width: 60%;
}
.main main .content h1 {
  font-size: 16px;
  margin-bottom: 10px;
  margin-top: 10px;
}
.main main .content footer {
  display: flex;
  padding: 10px;
  justify-content: space-between;
}
.main main .content footer .price {
  width: 60px;
}
.main main .content footer .price div {
  font-size: 14px;
  color: red;
}
.main main .content footer .price p {
  font-size: 18px;
  color: red;
}
.main main .content footer .price span {
  font-size: 12px;
  color: gray;
  text-decoration: line-through;
}
.main main .content footer .btn {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 0;
}
.main main .content footer .btn button {
  width: 70px;
  height: 30px;
  background-color: rgb(194, 187, 187);
  border-radius: 20px;
  border: none;
  color: white;
}
.main main .content footer .btn span {
  font-size: 12px;
  color: red;
}
</style>